<template>
  <div>
    <!--<div><el-button @click="search">搜索</el-button></div>-->
    <!-- <el-menu
      :default-active="activeIndex"
      class="el-menu-demo"
      mode="horizontal"
      @select="handleSelect"
    >
      <el-menu-item index="1" @click="turnportal">个人中心</el-menu-item>
      <el-menu-item index="2" @click="turnhistory">浏览记录</el-menu-item>
      <el-menu-item index="3">我的收藏</el-menu-item>
    </el-menu> -->
    <div class="search_box">
      <div class="search_input">
        <el-input
          placeholder="请输入需要检索的文献信息..."
          v-model="searchkeywords"
        >
          <el-select
            v-model="select"
            slot="prepend"
            placeholder="检索类别"
            style="width: 120px"
          >
            <el-option
              v-for="item in advance_options"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            ></el-option>
          </el-select>
          <el-button
            slot="append"
            icon="el-icon-search"
            @click="search(false)"
          ></el-button
          ><el-divider
            direction="vertical"
            slot="append"
            style="padding: 0 15px"
          ></el-divider
          ><el-button slot="append" @click="search(true)"
            >高级检索</el-button
          ></el-input
        >
      </div>

      <div class="left">
        <el-container>
          <el-header>
            <span class="title">热门搜索</span>
          </el-header>

          <el-table :data="currenttitle">
            <el-table-column label="排名" prop="rank" width="50">
            </el-table-column>
            <el-table-column label="标题" prop="title" width="400">
            </el-table-column>
            <el-table-column>
              <el-button type="text" @click="search"> 查看 </el-button>
            </el-table-column>
          </el-table>
        </el-container>
      </div>

      <div class="right">
        <el-container>
          <el-header>
            <span class="title">知名学者</span>
          </el-header>
          <el-table :data="currentauthor">
            <el-table-column prop="rank" label="排名" width="100">
            </el-table-column>
            <el-table-column prop="name" label="姓名" width="100">
            </el-table-column>
            <el-table-column prop="num" label="论文数" width="150">
            </el-table-column>
            <el-table-column>
              <el-button type="text" @click="search"> 查看作者文章 </el-button>
            </el-table-column>
          </el-table>
        </el-container>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  created() {
    this.changecurrent();
  },
  data() {
    return {
      searchkeywords: "", //检索关键字
      select: "", //检索类别
      currenttitle: [
        {
          title: "",
          rank: "",
        },
      ],
      currentauthor: [
        {
          name: "",
          num: "",
          rank: "",
        },
      ],
      titlenum: 3,
      title_list: [
        {
          title: "文章一1322233333333344444444444",
          rank: "1",
        },
        {
          title: "文章二",
          rank: "2",
        },
        {
          title: "文章三",
          rank: "3",
        },
      ],
      typenum: 3,
      author_list: [
        {
          name: "张三",
          num: 12333,
          rank: 1,
        },
        {
          name: "李四",
          num: 123,
          rank: 2,
        },
        {
          name: "王五",
          num: 12,
          rank: 3,
        },
      ],
      advance_options: [
        //高级检索分类
        {
          value: "选项1",
          label: "关键词",
        },
        {
          value: "选项2",
          label: "篇名",
        },
        {
          value: "选项3",
          label: "作者",
        },
        {
          value: "选项4",
          label: "单位",
        },
        {
          value: "选项5",
          label: "摘要",
        },
        {
          value: "选项6",
          label: "分类号",
        },
        {
          value: "选项7",
          label: "DOI",
        },
      ],
    };
  },
  methods: {
    search(isAdvance) {
      this.$store.commit("search", {
        keyword: this.searchkeywords,
        option: this.select,
        isAdvance: isAdvance,
      });
      this.$router.push("/Search");
    },
    turnportal() {
      this.$router.push("/Portal");
    },
    turnhistory() {
      this.$router.push("/History");
    },
    changecurrent() {
      this.currenttitle = [];
      this.currentauthor = [];
      for (var i = 0; i < this.titlenum; i++) {
        var a = {
          title: "",
          rank: "",
        };
        a.title = this.title_list[i].title;
        a.rank = this.title_list[i].rank;
        this.currenttitle.push(a);
      }
      for (var i = 0; i < this.typenum; i++) {
        var b = {
          name: "",
          num: "",
          rank: "",
        };
        b.name = this.author_list[i].name;
        b.num = this.author_list[i].num;
        b.rank = this.author_list[i].rank;
        this.currentauthor.push(b);
      }
    },
  },
};
</script>

<style lang="less" scoped>
.whole {
  width: 65%;
  height: 100%;
  margin: 0 auto;
  background-color: #ffffff;
  font-family: "Microsoft YaHei";
  min-width: 700px;
}
.search_box {
  // background-color: blue;
  height: 60px;
  width: 60%;
  margin: 0px auto;
  padding-top: 25px;
}
/deep/.el-divider--vertical {
  height: 2em;
  margin: 0 18px;
}
.advance_search {
  margin: 15px auto;
  width: 87%;
}
.advance_item {
  margin: 10px auto;
  text-align: center;
}
.search_list {
  margin-top: 40px;
  min-height: 450px;
}
.search_set {
  font-size: 17px;
  margin: 15px 0;
  text-align: right;
}
.order {
  display: inline;
  margin: 0 10px;
  user-select: none;
}
.order_choose {
  color: #0f5de5;
}
.order:hover {
  color: #0f5de5;
  cursor: pointer;
}
.card_foot {
  float: right;
  font-size: 13px;
  color: #666666;
}
.list_card {
  padding: 10px 35px;
  border-top: 1px dashed #ccc;
  border-right: 1px solid #ccc;
  border-left: 1px solid #ccc;
}
.title {
  display: inline-block;
  padding: 7px 0;
  font-size: 20px;
  font-family: "Microsoft YaHei";
  font-weight: bold;
  color: #215db1;
  user-select: none;
}
.title:hover {
  color: #ff6c00;
  cursor: pointer;
}
.author {
  font-size: 13px;
  color: #417dc9;
  display: inline-block;
  padding: 7px 7px;
  user-select: none;
}
.author:hover {
  color: #ff6c00;
  cursor: pointer;
}
.date {
  float: right;
  margin-right: 100px;
  font-size: 13px;
  user-select: none;
  color: #666666;
}
.abstract {
  font-size: 12px;
  color: #666666;
  user-select: none;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.keywords:hover {
  cursor: pointer;
  color: #ff6c00;
}
.keywords {
  font-size: 13px;
  color: #417dc9;
  display: inline-block;
  padding: 7px 5px;
  text-decoration: underline;
}
.button {
  font-size: 14px;
  color: #417dc9;
  display: inline-block;
  padding: 4px 10px;
  margin-right: 15px;
  border-radius: 5px;
  border: 1px solid #417dc9;
  user-select: none;
}
.button:hover {
  background-color: #417dc9;
  color: white;
  cursor: pointer;
}
/deep/.el-icon-reading {
  padding-right: 4px;
}
/deep/.el-icon-folder-add {
  padding-right: 4px;
}
.left {
  position: absolute;
  width: 500px;
  top: 230px; /* 距离上面的像素 */
  left: 0px;
  bottom: 0px;
  overflow-y: auto; /* 当内容过多时y轴出现滚动条 */
}

.right {
  position: absolute;
  top: 230px;
  left: 500px;
  bottom: 0px;
  right: 0px; /* 距离右边0像素 */
  padding: 10px;
  overflow-y: auto; /* 当内容过多时y轴出现滚动条 */
  /* background-color: red; */
}
.title {
  display: inline-block;
  padding: 7px 0;
  font-size: 20px;
  font-family: "Microsoft YaHei";
  font-weight: bold;
  color: #215db1;
  user-select: none;
}
</style>